<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文件上传</title>
    <script src="/layui/layui.js"></script>
    <link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>

    <button type="button" class="layui-btn" id="test1" style="margin-top: 80px;margin-left: 150px">
        <i class="layui-icon">&#xe67c;</i>上传文件
    </button>

<script>
    layui.use('upload', function(){
        var upload = layui.upload;

        upload.render({
            elem: '#test1',
            url: '/Excel/importExcel',
            method: "post",
            field: 'fil',
            accept: 'file',
            done: function(res, index, upload){
                var layer = parent.layer;
                layer.close(layer.index);
            },
            error:function(index){
                var layer = parent.layer;
                layer.close(layer.index);
            }
        })
    });
</script>
</body>
</html>